package com.sky.mapper.user;

import com.sky.pojo.Category;
import com.sky.pojo.Dish;
import com.sky.pojo.DishFlavor;
import com.sky.pojo.Setmeal;
import com.sky.vo.DishItemVO;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper {

    /**
     * 根据id查询菜品口味
     */
    List<DishFlavor> queryByDishIds(List<Long> dishIds);

    /**
     * 查询分类列表
     */
    @Select("select * from category where status = 1")
    List<Category> queryList();

    /**
     * 根据分类id查询菜品
     */
    @Select("select * from dish where category_id = #{id} and status = 1;")
    List<DishVO> queryDishList(Long id);

    /**
     * 根据分类id查询套餐
     */
    @Select("select * from setmeal where category_id = #{categoryId} and status = 1")
    List<Setmeal> querySetmealList(Integer categoryId);

    /**
     * 根据套餐id查询包含的菜品
     */
    @Select("SELECT d.* from setmeal_dish sd INNER JOIN dish d ON sd.dish_id = d.id ")
    List<DishItemVO> queryDishBySId(Integer setmealId);
}
